package com.ebc.eservice.util;

import java.text.NumberFormat;

/**
 * @author: Joey
 * @Description: 小数点计算
 * @date:2022/10/1 20:35
 */
public class DemicalUtil {


    public double DoubleFormat(double fs){
        NumberFormat ddf= NumberFormat.getNumberInstance() ;
        ddf.setMaximumFractionDigits(2);
        String format = ddf.format(fs);
        return Double.parseDouble(format);
    }

    public static void main(String[] args) {
        DemicalUtil demicalUtil = new DemicalUtil();
        double ls = 0.33333333;
        double v = demicalUtil.DoubleFormat(ls);
        System.out.println(v);
    }

}
